//
//  WSSupeiView.m
//  家范
//
//  Created by 吴军虎吴军虎 on 16/4/9.
//  Copyright © 2016年 lanjue. All rights reserved.

#import "SupeiView.h"

#define MAINCOLOR [UIColor colorWithRed:248/255.0 green:233/255.0 blue:112/255.0 alpha:1]


@interface SupeiView (){

    NSInteger width;
}


@property(nonatomic,retain)  UIImageView *NaImage;

@end

@implementation SupeiView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        width = frame.size.width;
        [self createSubView];
    }
    return self;
}

- (void)createSubView {

    //黄色底图
    UIView *aView = [[UIView alloc]init];
    aView.backgroundColor = GH;
    aView.userInteractionEnabled=YES;
    [self addSubview:aView];
    [aView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(@0);
        make.left.mas_equalTo(@0);
        make.width.mas_equalTo(self.frame.size.width);
        make.height.mas_equalTo(401.00/2*AUTO_WIDTH);

        
    }];
    
    //图像
    _TXimage = [[UIImageView alloc]init];
    _TXimage.backgroundColor = GH;
    _TXimage.image = [UIImage imageNamed:@"headBackImage"];
    _TXimage.layer.cornerRadius = 80.00*AUTO_WIDTH/2;
    _TXimage.layer.masksToBounds = YES;
    [aView addSubview:_TXimage];
    [_TXimage mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(aView).offset(70.00*AUTO_WIDTH/2);
        make.left.equalTo(aView).offset(250.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(80.00*AUTO_WIDTH,80.00*AUTO_WIDTH ));
        
    }];
    
    self.topHeadView = [[UIImageView alloc]init];
    self.topHeadView.layer.cornerRadius = 80.00*AUTO_WIDTH/2;
    self.topHeadView.layer.masksToBounds = YES;
    self.topHeadView.alpha = 0;
    [aView addSubview:_topHeadView];
    [self.topHeadView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage);
        make.left.equalTo(_TXimage);
        make.size.equalTo(_TXimage);
    }];
    
//    //头像小图标
//    _NaImage=[[UIImageView alloc]init];
//    _NaImage.image=[UIImage imageNamed:@"header_men"];
//    [aView addSubview:_NaImage];
//    [_NaImage mas_makeConstraints:^(MASConstraintMaker *make){
//        
//        make.top.equalTo(aView.mas_top).offset(72/2 *AUTO_WIDTH);
//        make.left.equalTo(aView.mas_left).offset(364/2 *AUTO_WIDTH);
//        make.size.mas_equalTo(CGSizeMake(18.00 *AUTO_WIDTH, 18.00 *AUTO_WIDTH));
//    }];
//    
//    
//    //认证
//    UIImageView *renZhangIM = [[UIImageView alloc]init];
//    renZhangIM.image = [UIImage imageNamed:@"header_testInfo_yes"];
//    [aView addSubview:renZhangIM];
//    [renZhangIM mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.top.equalTo(_TXimage.mas_bottom).offset(-30.00*AUTO_WIDTH);
//        make.left.equalTo(_TXimage).offset((80.00*AUTO_WIDTH-55.00*AUTO_WIDTH)/2);
//        make.size.mas_equalTo(CGSizeMake(55.00*AUTO_WIDTH, 52.00*AUTO_WIDTH));
//        
//    }];
    
    
    //张三件
    UILabel *YHlabel = [[UILabel alloc]init];
    YHlabel.text = @"张三件";
    YHlabel.textColor=[UIColor whiteColor];
    YHlabel.font = [UIFont systemFontOfSize:17.00*AUTO_WIDTH];
    [aView addSubview:YHlabel];
    [YHlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage.mas_bottom).offset(50.00*AUTO_WIDTH/2);
        make.left.equalTo(aView).offset(180.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(YHlabel.text.length*17.20*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    
    //第一个竖线
    UILabel *line1 = [[UILabel alloc]init];
    line1.backgroundColor  =[UIColor whiteColor];
    [aView addSubview:line1];
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage.mas_bottom).offset(50.00*AUTO_WIDTH/2);
        make.left.equalTo(YHlabel.mas_right).offset(12.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(1.50*AUTO_WIDTH,15.00*AUTO_WIDTH));
        
    }];
    
    
    //男
    UILabel *GSlabel = [[UILabel alloc]init];
    GSlabel.text = @"男";
    GSlabel.textColor=[UIColor whiteColor];
    GSlabel.font = [UIFont systemFontOfSize:17.00*AUTO_WIDTH];
    [aView addSubview:GSlabel];
    [GSlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage.mas_bottom).offset(50.00*AUTO_WIDTH/2);
        make.left.equalTo(line1.mas_right).offset(12.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(GSlabel.text.length*17.20*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //第二个竖线
    UILabel *line2 = [[UILabel alloc]init];
    line2.backgroundColor  =[UIColor whiteColor];
    [aView addSubview:line2];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage.mas_bottom).offset(50.00*AUTO_WIDTH/2);
        make.left.equalTo(GSlabel.mas_right).offset(12.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(1.50*AUTO_WIDTH,15.00*AUTO_WIDTH));
        
    }];
    
    
    //现代简约
    UILabel *DDlabe = [[UILabel alloc]init];
    DDlabe.text = @"现代简约";
    DDlabe.textColor=[UIColor whiteColor];
    DDlabe.font = [UIFont systemFontOfSize:17.00*AUTO_WIDTH];
    [aView addSubview:DDlabe];
    [DDlabe mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_TXimage.mas_bottom).offset(50.00*AUTO_WIDTH/2);
        make.left.equalTo(line2.mas_right).offset(12.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(DDlabe.text.length*17.20*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //任务面积
    UILabel *renlabel=[[UILabel alloc]init];
    renlabel.text=@"任务面积111㎡";
    renlabel.textColor=[UIColor whiteColor];
    renlabel.font=[UIFont systemFontOfSize:15];
    [aView addSubview:renlabel];
    [renlabel mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(DDlabe.mas_bottom).offset(20/2*AUTO_WIDTH);
        make.left.equalTo(aView.mas_left).offset(240/2 *AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(renlabel.text.length *30*AUTO_WIDTH, 15 *AUTO_WIDTH));
    }];
    
    
    //白色底图
    UIView *bView = [[UIView alloc]init];
    bView.backgroundColor = [UIColor whiteColor];
    bView.userInteractionEnabled=YES;
    [self addSubview:bView];
    [bView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(aView.mas_bottom).offset(0.00*AUTO_WIDTH);
        make.left.equalTo(self);
        make.width.mas_equalTo(self.frame.size.width);
        make.height.mas_equalTo(448.00/2*AUTO_WIDTH);
    }];
    
    
    //平层户型
    UILabel *nameL = [[UILabel alloc]init];
    nameL.text = @"平层户型";
    nameL.textColor=GH;
    nameL.alpha = 0.7;
    nameL.textAlignment = NSTextAlignmentCenter;
    nameL.font = [UIFont systemFontOfSize:16];
    [bView addSubview:nameL];
    [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(bView).offset(10.00*AUTO_WIDTH/2);
        make.centerX.mas_equalTo(@0);
        make.size.mas_equalTo(CGSizeMake(200.00*AUTO_WIDTH, 30.00*AUTO_WIDTH));
        
    }];
    
    
    //第一个横线
    UIImageView *imageViewLin = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xu"]];
    imageViewLin.backgroundColor = [UIColor whiteColor];
    [self addSubview:imageViewLin];
    [imageViewLin mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(nameL.mas_bottom).offset(10.00*AUTO_WIDTH/2);
        make.left.equalTo(bView).offset(29.00*AUTO_WIDTH/2);
        make.right.equalTo(bView.mas_right).offset(-29.00*AUTO_WIDTH/2);
        make.height.mas_equalTo(1);
        
    }];
    
    
    //第二个横线
    UIImageView *imageViewLin4 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xu"]];
    imageViewLin4.backgroundColor = [UIColor whiteColor];
    [self addSubview:imageViewLin4];
    [imageViewLin4 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(imageViewLin.mas_bottom).offset(142.00*AUTO_WIDTH/2);
        make.left.equalTo(bView).offset(29.00*AUTO_WIDTH/2);
        make.right.equalTo(bView.mas_right).offset(-29.00*AUTO_WIDTH/2);
        make.height.mas_equalTo(1);
        
    }];
    
    
    UIImageView *imageViewLin11 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shu"]];
    imageViewLin11.backgroundColor = [UIColor whiteColor];
    [bView addSubview:imageViewLin11];
    [imageViewLin11 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(imageViewLin.mas_bottom).offset(10.00*AUTO_WIDTH/2);
        make.bottom.equalTo(imageViewLin4.mas_bottom).offset(-10.00*AUTO_WIDTH/2);
        make.left.equalTo(bView.mas_left).offset(170/2 *AUTO_WIDTH);
        make.width.mas_equalTo(1);
        
    }];
    
    
    UIImageView *imageViewLin21 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shu"]];
    imageViewLin21.alpha = 1;
    imageViewLin21.backgroundColor = [UIColor whiteColor];
    [bView addSubview:imageViewLin21];
    [imageViewLin21 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(imageViewLin.mas_bottom).offset(10.00*AUTO_WIDTH/2);
        make.bottom.equalTo(imageViewLin4.mas_bottom).offset(-10.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin11.mas_left).offset(165/2 *AUTO_WIDTH);
        make.width.mas_equalTo(1);
        
    }];
    
    
    UIImageView *imageViewLin2 = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shu"]];
    imageViewLin2.alpha = 1;
    imageViewLin2.backgroundColor = [UIColor whiteColor];
    [bView addSubview:imageViewLin2];
    [imageViewLin2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(imageViewLin.mas_bottom).offset(10.00*AUTO_WIDTH/2);
        make.bottom.equalTo(imageViewLin4.mas_bottom).offset(-10.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin21.mas_left).offset(165/2 *AUTO_WIDTH);
        make.width.mas_equalTo(1);
        
    }];
    
    //30-50的上图
    UIImageView *adressIM = [[UIImageView alloc]init];
    adressIM.image = [UIImage imageNamed:@"find_RMB"];
    [bView addSubview:adressIM];
    [adressIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageViewLin.mas_bottom).offset(35.00*AUTO_WIDTH/2);
        make.left.equalTo(bView).offset(80.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
    }];
    
    
    //30-50
    UILabel *addressL = [[UILabel alloc]init];
    addressL.text = @"30-50";
    addressL.textColor = HS;
    addressL.font = [UIFont systemFontOfSize:12];
    addressL.textAlignment=NSTextAlignmentCenter;
    [bView addSubview:addressL];
    [addressL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(adressIM.mas_bottom).offset(18.00*AUTO_WIDTH/2);
        make.centerX.equalTo(adressIM).offset(3.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(addressL.text.length*18.00*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //1-3年的上图
    UIImageView *workIM = [[UIImageView alloc]init];
    workIM.image = [UIImage imageNamed:@"find_exp"];
    [bView addSubview:workIM];
    [workIM mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(imageViewLin.mas_bottom).offset(35.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin21).offset(68.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
    }];
    
    //1-3年
    UILabel *workL = [[UILabel alloc]init];
    workL.text = @"1-3年";
    workL.textColor = HS;
    workL.font = [UIFont systemFontOfSize:12];
    workL.textAlignment=NSTextAlignmentCenter;
    [bView addSubview:workL];
    [workL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(workIM.mas_bottom).offset(18.00*AUTO_WIDTH/2);
        make.centerX.equalTo(workIM).offset(1.00*AUTO_WIDTH);
        make.size.mas_equalTo(CGSizeMake(workL.text.length*18.00*AUTO_WIDTH, 15.00*AUTO_WIDTH));
        
    }];
    
    //999上图
    UIImageView *peopleIM = [[UIImageView alloc]init];
    peopleIM.image = [UIImage imageNamed:@"find_pepNum"];
    [bView addSubview:peopleIM];
    [peopleIM mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageViewLin.mas_bottom).offset(35.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin11).offset(68.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
    }];
    

    //999人
    UILabel *peopleL = [[UILabel alloc]init];
    peopleL.text = @"999人";
    peopleL.textColor = HS;
    peopleL.textAlignment=NSTextAlignmentCenter;
    peopleL.font = [UIFont systemFontOfSize:12];
    [bView addSubview:peopleL];
    [peopleL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(peopleIM.mas_bottom).offset(18.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin11).offset(40.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(50.00*AUTO_WIDTH, 16.00*AUTO_WIDTH));
        
    }];
    
    
    //杭州上图
    UIImageView *nanImage = [[UIImageView alloc]init];
    nanImage.image = [UIImage imageNamed:@"di"];
    [bView addSubview:nanImage];
    [nanImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(imageViewLin.mas_bottom).offset(35.00*AUTO_WIDTH/2);
        make.right.equalTo(bView).offset(-74.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(18.00*AUTO_WIDTH, 18.00*AUTO_WIDTH));
    }];
    
    
    //杭州
    UILabel *nanL = [[UILabel alloc]init];
    nanL.text = @"杭州";
    nanL.textColor = HS;
    nanL.textAlignment=NSTextAlignmentCenter;
    nanL.font = [UIFont systemFontOfSize:12];
    [bView addSubview:nanL];
    [nanL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(nanImage.mas_bottom).offset(18.00*AUTO_WIDTH/2);
        make.left.equalTo(imageViewLin2).offset(18.00*AUTO_WIDTH/2);
        make.size.mas_equalTo(CGSizeMake(50.00*AUTO_WIDTH, 16.00*AUTO_WIDTH));
        
    }];

    
    
    //添加文字信息
    UILabel *lab=[[UILabel alloc]init];
    lab.text=@"找淘宝平面模特拍摄装找淘宝平面模特拍摄装找淘宝平面模特拍摄装";
    lab.font=[UIFont systemFontOfSize:13.00 *AUTO_WIDTH];
    lab.alpha=0.7;
    [bView addSubview:lab];
    [lab mas_makeConstraints:^(MASConstraintMaker *make){
        
        make.top.equalTo(imageViewLin4.mas_bottom).offset(25/2 *AUTO_WIDTH);
        make.left.equalTo(bView.mas_left).offset(29/2 *AUTO_WIDTH);
        make.right.equalTo(bView.mas_right).offset(-100/2 *AUTO_WIDTH);
    }];
}


@end
